package com.kitri.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kitri.dao.AppContext;
import com.kitri.dao.SubjectDao;
import com.kitri.dao.SubjectDaoImpl;
import com.kitri.domain.Subject;

@Service
public class SubjectServiceImpl implements SubjectService {
	private SubjectDao subjectDao = null;
	

	public SubjectServiceImpl() {
		this.subjectDao = ((SubjectDaoImpl)AppContext.getAppContext().getBean("subjectDao"));
	}

	@Override
	public void add(String subjectName) {
		subjectDao.insert(subjectName);
	}

	@Override
	public void remove(String subjectId) {
		subjectDao.delete(subjectId);
	}

	@Override
	public void update(Subject subject) {
		subjectDao.update(subject);
	}

	@Override
	public List<Subject> list() {
		return subjectDao.selectAll();
	}
}
